import { usePathname } from "next/navigation";
import { useMemo } from "react";

export function useAgentCode() {
  const pathname = usePathname();
  const agentCode = useMemo(() => {
    const pathnames = pathname.split("/");
    const agentCode = pathnames[pathnames.length - 1];
    return agentCode ?? "default";
  }, [pathname]);

  return agentCode;
}
